package javalaoniu.gitee.io.demo.logback.controller;

import javalaoniu.gitee.io.demo.logback.exception.AppException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class LogTestController {

    @RequestMapping("error-test1")
    public String errorTest1() {
        int x = 0;
        // 测试错误异常
        int y = 2 / x;
        return x + y + "";
    }

    @RequestMapping("error-test2")
    public String errorTest2() {
        // 主动抛出异常
        throw new RuntimeException("gg 了");
    }

    @RequestMapping("error-test3")
    public String errorTest3() {
        // 主动抛出异常
        throw new AppException("抛出自定义异常测试");
    }
}
